package com.java.status;


/**
 * @author Smile.Wu
 * @date 2015年12月7日  下午5:36:48
 */
public class StatusTest {
	public static final short STATUS_1 = 1;
	public static final short STATUS_2 = 2;
	public static final short STATUS_3 = 4;
	public static final short STATUS_4 = 8;
	public static final short STATUS_5 = 16;
	public static final short STATUS_6 = 32;
	public static final short STATUS_7 = 64;
	public static final short STATUS_8 = 128;

	public static void main(String[] args) {
		
		int status = 0;
		
		status = status | STATUS_1;
		status = status | STATUS_2;
		status = status | STATUS_4;
		
		System.out.println((status & STATUS_1) > 0);
		System.out.println((status & STATUS_2) > 0);
		System.out.println((status & STATUS_3) > 0);
		System.out.println((status & STATUS_4) > 0);
		System.out.println((status & STATUS_5) > 0);
		System.out.println((status & STATUS_6) > 0);
		System.out.println((status & STATUS_7) > 0);
		System.out.println((status & STATUS_8) > 0);
		
		
		long b = System.nanoTime();
		long max = 10000000;
		short s = 64;
		for(int i = 0; i < max; i ++) {
			status = status | s;
		}
		System.out.println("cost " + (System.nanoTime() - b) / 1000000);
	}
}
